test: tail in tests#817
Open
john-royal wants to merge 10 commits into
Open
Conversation
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/090af9c@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/090af9c@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/090af9c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deploying with
Test.make({ log: true })now streams deployed Workers'console.*output into the test console with sub-second latency — Cloudflare's tail API is too slow to be useful in tests.With logging enabled, the Worker bundle's virtual entry patches
console.*to mirror lines into an account-levelalchemy-test-loggersingleton hosting one SQLite-buffered Durable Object per{stack}/{stage}.WorkerProvider.tailstreams from that DO over a websocket (buffered replay on connect + live push, deduped by row id across reconnects) when the worker's newtestLoggerattribute is set, and falls back to the Cloudflare tail API otherwise.src/Tail.ts: tail orchestration extracted from the CLI (alchemy tailis now a thin wrapper).Deploy.deploy({ tail: true })forks it after apply; the test harness ties the fiber to its shared scope, so logs flow frombeforeAlluntildestroy/afterAll.reconcileinstead of via anenableTestLogginglayer inCloudflare.providers(): memoized per account per process, content-hash versioned, and guarded by the newUtil/FileSemaphore.ts(a lockfile-backed, key-partitioned cross-process mutex) so concurrent vitest processes don't raceputScript.Workergains atestLoggeroutput attribute, set during reconcile and reconstructed byreadfrom the observedALCHEMY_TEST_LOGGERDO binding. Only set where the bundle is patchable —script:,bundle: false, and dispatch-namespace workers keep the standard tail path.